import random
import socket
import turtle
import re
import time
# randint(a,b)随机a-b整数
a = random.randint(1, 2)
print(a)

# randrange(start,end,step)生成指定范围指定频率的整数
b = random.randrange(1, 12, 2)
print(b)

# random()生成0-1随机小数
c = random.random()
print(c)


# choice(seq) 从序列里面随机选出一个值，choices(seq)从序列里面随机选出一个值作为列表返回
a = [1, 2, 3, 4, 5, 6]
d = random.choice(a)
e = random.choices(a)
print(d, e)


# turple
# i = 1
# while i < 50:
#     turtle.speed(20)
#     turtle.forward(100)  # 直线
# #    turtle.back(100)  # 箭头回退
#     turtle.left(69)
#     #turtle.right(30)
#     #turtle.setx(0)
#     #turtle.sety(0)
#     #turtle.clear()
#     #turtle.color("red")
#     turtle.forward(100)
#     i += 1
# turtle.penup()
#
# turtle.setx(0)
# turtle.sety(0)
# turtle.pendown()
# i = 1
# while i < 50:
#     turtle.speed(20)
#     turtle.forward(100)  # 直线
# #    turtle.back(100)  # 箭头回退
#     turtle.left(85)
#     #turtle.right(30)
#     #turtle.setx(0)
#     #turtle.sety(0)
#     #turtle.clear()
#     #turtle.color("red")
#     turtle.forward(100)
#     i += 1
# turtle.penup()
# time
# 获取时间戳
f = time.time()
print(f)

f = time.thread_time()
print(f)
f = time.process_time()
print(f)


# 获取格林威治结构时间
fx = time.gmtime()  # (tm_year=2025, tm_mon=1, tm_mday=8, tm_hour=10, tm_min=6, tm_sec=6, tm_wday=2, tm_yday=8,tm_isdst=0)
print(fx)
print(fx.tm_year)


f = time.strptime("2025-07-07 12:35:23","%Y-%m-%d %H:%M:%S")
print(f)


f2 = time.localtime()
f = time.strftime("%Y-%m-%d %H:%M:%S", f2)
print(f)
f = f2